﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Campus.Main.Basic.InsertValues;
using cpmntctrl;
using dbcntn;

namespace Campus.Main.Basic.Settings
{
    public partial class ParentStateForm : StudentHandicapForm
    {
        public ParentStateForm()
        {
            InitializeComponent();
        }
        public override void Initialize()
        {
            aToDb.AddItemDBGridView(dataGridView1,Query.ParentState);
            ControlComponent.UnVisibleCells(dataGridView1,0);
        }
        protected override void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Length>0&&textBox2.Text.Length>0)
            {
                string desc = textBox1.Text.Trim(',', '-');
                string ball = textBox2.Text.Trim();
                aToDb.InsertIntoTable("parentstate", "ball", "description", Int32.Parse(ball), desc);
                ControlComponent.Clear(textBox1, textBox2);
            }
            else
            {
                ShowMessage.ShowWarningMessage(textBox1,textBox2);
            }
        }
        protected override void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex==-1||e.ColumnIndex==-1)
                return;
            ControlComponent.AddToList(data,dataGridView1,e,0,1,2);
            ParentState f=new ParentState(data);
            f.FormClosed += Bind;
            f.ShowDialog();
        }
    }
}
